﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Net.Formats.oEmbed
{
    
    
    /// <summary>
    ///This is a test class for PhotoResponseTest and is intended
    ///to contain all PhotoResponseTest Unit Tests
    ///</summary>
    [TestClass( )]
    public class PhotoResponseTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Width
        ///</summary>
        [TestMethod]
        public void WidthPositiveTest( )
        {
            var target = new PhotoResponse( ); 
            Nullable<int> expected = new Nullable<int>( 40 ); 
            Nullable<int> actual;
            target.Width = expected;
            actual = target.Width;
            Assert.AreEqual( expected, actual );            
        }

        /// <summary>
        ///A test for Width
        ///</summary>
        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void WidthNegativeTest( )
        {
            var target = new PhotoResponse( );
           
            Nullable<int> actual = null;
            
            Assert.AreEqual( target.Width, actual );
        }

        /// <summary>
        ///A test for Url
        ///</summary>
        [TestMethod]
        public void UrlPositiveTest( )
        {
            var target = new PhotoResponse( ); // TODO: Initialize to an appropriate value
            Uri expected = new Uri("http://testurl.com/image.jpg"); // TODO: Initialize to an appropriate value
            Uri actual;
            target.Url = expected;
            actual = target.Url;
            Assert.AreEqual( expected, actual );

            expected = new Uri( "https://testurl.com/image.jpg" );
            target.Url = expected;
            actual = target.Url;
            Assert.AreEqual( expected, actual );
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void UrlNegativeTest( )
        {
            var target = new PhotoResponse( ); // TODO: Initialize to an appropriate value
            Uri expected = new Uri( "ftp://testurl.com/image.jpg" ); // TODO: Initialize to an appropriate value
            Uri actual;
            target.Url = expected;
            actual = target.Url;
            Assert.AreEqual( expected, actual ); 
        }

        /// <summary>
        ///A test for Height
        ///</summary>
        [TestMethod]
        public void HeightPositiveTest( )
        {
            PhotoResponse target = new PhotoResponse( ); // TODO: Initialize to an appropriate value
            Nullable<int> expected = new Nullable<int>( 300 ); // TODO: Initialize to an appropriate value
            Nullable<int> actual;
            target.Height = expected;
            actual = target.Height;
            Assert.AreEqual( expected, actual );            
        }

        /// <summary>
        ///A test for Height
        ///</summary>
        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void HeightNegativeTest( )
        {
            PhotoResponse target = new PhotoResponse( ); // TODO: Initialize to an appropriate value
            Nullable<int> expected = null; // TODO: Initialize to an appropriate value
            Nullable<int> actual;
            target.Height = expected;
            actual = target.Height;
            Assert.AreEqual( expected, actual );
        }

        /// <summary>
        ///A test for PhotoResponse Constructor
        ///</summary>
        [TestMethod]
        public void PhotoResponseConstructorTest( )
        {
            var target = new PhotoResponse( );
            Assert.AreEqual( ResponseType.Photo, target.Type );
        }
    }
}
